//
//  KnowView.m
//  FoodFamily
//
//  Created by dlios on 15-6-22.
//  Copyright (c) 2015年 guoBang. All rights reserved.
//

#import "KnowView.h"

@implementation KnowView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame and:(Movie *)mov
{self = [super initWithFrame:frame];
    if (self) {
        self.movie = mov;
        [self KnowView];
        
       //NSLog(@"11%@",self.movie.imagePath1);
    }

    return self;
}
-(void)KnowView
{
    self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT-20-44-49)];;
    //self.scrollView.pagingEnabled = YES;//按页翻
    //self.scrollView.bounces = NO;//禁止边界反弹效果
    if (WIDTH< 375) {//判断
        self.scrollView.contentSize = CGSizeMake(0, HEIGHT);
    }
    
    self.scrollView.showsHorizontalScrollIndicator = YES;//隐藏横向水平滑动条
    self.scrollView.showsVerticalScrollIndicator = NO;//隐藏纵向滑动条
    self.scrollView.backgroundColor = [UIColor clearColor];
    //返回顶部
    self.scrollView.scrollsToTop = YES;
    [self addSubview:self.scrollView];

    
    
//    UIImageView *imageview = [[UIImageView alloc]initWithImage:image];
    
    
    UIImageView *imageview = [[UIImageView alloc]initWithFrame:CGRectMake(25*COEFFICIENTW, 100, 325*COEFFICIENTH, 240)];
    imageview.image = [UIImage imageNamed:@"cailiaobeijing.png"];
    [self.scrollView addSubview:imageview];
    self.myimageview = [[UIImageView alloc]initWithFrame:CGRectMake(10*COEFFICIENTW, 8, 300*COEFFICIENTH,220)];
    self.myimageview.backgroundColor = [UIColor clearColor];
    [imageview addSubview:self.myimageview];
    NSURL *url = [NSURL URLWithString:self.movie.imagePath1];
    [self.myimageview sd_setImageWithURL:url];
    //[self.myimageview addSubview:imageview];
    //NSLog(@"self.movie.imagePath1 ==%@",self.movie.imagePath1);
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10*COEFFICIENTW, 20, 200*COEFFICIENTH, 40)];
    label.text = @"相关常识";
     [label setFont:[UIFont fontWithName:@"Helvetica-Bold" size:23]];
    label.textColor = [UIColor colorWithHexString:@"663300"];
    label.font = [UIFont systemFontOfSize:23];
    label.textAlignment = 25;
    [self.scrollView addSubview:label];
    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(10*COEFFICIENTW, 55, 400*COEFFICIENTH, 40)];
    label1.text = @"FOOD NUTRITION COMMON KNOWLEDGE";
    [label1 setFont:[UIFont fontWithName:@"Helvetica-Bold" size:15]];
    label1.textColor = [UIColor colorWithHexString:@"663300"];
    [self.scrollView addSubview:label1];
    self.nutritionAnalysislabel= [[UILabel alloc]initWithFrame:CGRectMake(10*COEFFICIENTW, 330, 350*COEFFICIENTH, 130)];
    self.nutritionAnalysislabel.backgroundColor = [UIColor clearColor];
    self.nutritionAnalysislabel.text = self.movie.nutritionAnalysis;
    self.nutritionAnalysislabel.font = [UIFont systemFontOfSize:15];
    self.nutritionAnalysislabel.numberOfLines = 0;
    self.nutritionAnalysislabel.textColor = [UIColor colorWithHexString:@"996633"];
    [self.scrollView addSubview:self.nutritionAnalysislabel];
    
    UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(10*COEFFICIENTW, 460, 160*COEFFICIENTH, 40)];
    label2.text = @"制作指导";
    label2.textColor = [UIColor colorWithHexString:@"663300"];
    label2.font = [UIFont systemFontOfSize:23];
     [label2 setFont:[UIFont fontWithName:@"Helvetica-Bold" size:23]];
      //label2.backgroundColor = [UIColor lightGrayColor];
    label2.textAlignment = 20;
    [self.scrollView addSubview:label2];
    self.productionDirectionlabel = [[UILabel alloc]initWithFrame:CGRectMake(10*COEFFICIENTW,510, 300*COEFFICIENTH, 100)];
    self.productionDirectionlabel.text = self.movie.productionDirection;
    self.productionDirectionlabel.backgroundColor = [UIColor clearColor];
    self.productionDirectionlabel.numberOfLines = 0;
    self.productionDirectionlabel.textColor = [UIColor colorWithHexString:@"996633"];
    self.productionDirectionlabel.font = [UIFont systemFontOfSize:15];
    [self.productionDirectionlabel sizeToFit];//label自适应
    
   // self.productionDirectionlabel.lineBreakMode = NSLineBreakByCharWrapping;
    [self.scrollView addSubview:self.productionDirectionlabel];
    //NSLog(@"self.productionDirectionlabel.text ==%@",self.productionDirectionlabel.text);
}
@end
